#coding:utf-8
import time

def timestampToDatetime(v,f="%Y-%m-%d-%H:%M:%S"):
  '时间戳转时间'
  
  time_local = time.localtime(int(v))
  dt = time.strftime(f,time_local)
  return dt
  
def strToTimestamp(v):
  '字符串转时间戳'
  t=0
  try:
    t=int(time.mktime(time.strptime(v,'%Y-%m-%d %H:%M:%S')))
  except Error:
    pass
  return t
 